package com.example.sellersale.controller;

import com.example.sellersale.entity.Bill;
import com.example.sellersale.server.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class BillConrtroller {
    @Autowired
    private BillService billService;

    @GetMapping("/bills")
    public List<Bill> userBillInfo(String uId){
        List<Bill> bills = billService.userBillInfo(uId);
        return bills;
    }
    @PostMapping("/pay")
    public Bill addBillInfo(Bill bill){
        Bill bill1 =  billService.pay(bill);
        return bill1;
    }
}
